package br.com.affero.action;

import java.util.Set;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import br.com.affero.bean.Document;
import br.com.affero.bean.User;

public class ListDocumentsAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		User user = (User) request.getSession().getAttribute("user");
		Set<Document> documents = user.getDocuments();
		
		request.setAttribute("documents", documents);
		return mapping.findForward("list");
	}
	
}
